
use mogoroomdb;
BEGIN;

SELECT @id:=id from perm_functioninfo where fname = '系统管理';
SELECT @seq:=(MAX(seq)+1) FROM perm_functioninfo WHERE functionpId=@id;
SELECT @fcode:=CONCAT('2',LPAD(@id,4,0), lpad(@seq, 2, 0)) from perm_functioninfo where fname = '系统管理';

insert into perm_functioninfo
    select max(id)+1, @fcode, '文件热更新管理',null,@seq,1,@id,1,null,null,null,0,1,null,null,null,null,1,2 from perm_functioninfo;


select @pid:=id from perm_functioninfo where fname = '文件热更新管理';

select @pfcode1:=CONCAT('2',LPAD(@pid,4,0), lpad(1, 2, 0)) from dual;
select @pfcode2:=CONCAT('2',LPAD(@pid,4,0), lpad(2, 2, 0)) from dual;
select @pfcode3:=CONCAT('2',LPAD(@pid,4,0), lpad(3, 2, 0)) from dual;
select @pfcode4:=CONCAT('2',LPAD(@pid,4,0), lpad(4, 2, 0)) from dual;

insert into perm_functioninfo
  select max(id)+1,@pfcode1,'查询','fileversion/list',1,2,@pid,1,null,null,null,0,1,null,null,null,null,1,2 from perm_functioninfo union all
  select max(id)+2,@pfcode2,'添加','fileversion/addFileVersion',2,2,@pid,1,null,null,null,1,1,null,null,null,null,1,2 from perm_functioninfo union all
  select max(id)+3,@pfcode3,'删除','fileversion/disableFileVersion',3,2,@pid,1,null,null,null,1,1,null,null,null,null,1,2 from perm_functioninfo union all
  select max(id)+4,@pfcode4,'查看详情','fileversion/findFileVersionById',4,2,@pid,1,null,null,null,1,1,null,null,null,null,1,2 from perm_functioninfo;
COMMIT;
